package ru.payment.wm.impl;

import org.dom4j.Element;
import ru.payment.wm.AttestatRow;

/**
 *
 * User: sergey
 * Date: 23.04.2009
 * Time: 19:16:07
 *
 */
public class AttestatRowParser extends AbstractResponseParser<AttestatRow, Element> {

  public void parse(Element e, AttestatRow row) throws ProtocolException {
    if (e == null) {
      return;
    }

    row.setCid( attrAsInt(e.attribute("cid"), 0) );
    row.setRegistrarCid( attrAsInt(e.attribute("regcid"), 0) );
    row.setTid( attrAsInt(e.attribute("tid"), 0) );
    row.setLocked( attrAsBoolean(e.attribute("locked"), false) );
    row.setAdmlocked( attrAsBoolean(e.attribute("admlocked"), false) );
    row.setRecalled( attrAsBoolean(e.attribute("recalled"), false) );
    row.setCreateDate( attrAsDate(e.attribute("datecrt"), "yyyy-MM-dd'T'HH:mm:ss.SSS") );
    row.setRegistrarNickname( attrAsString(e.attribute("regnickname"), "") );
    row.setRegistrarWmId( attrAsString(e.attribute("regwmid"), "") );
  }

}
